package top.yxf.spring.context.event;

import top.yxf.spring.beans.factory.BeanFactory;
import top.yxf.spring.beans.factory.BeanFactoryAware;
import top.yxf.spring.context.ApplicationEvent;
import top.yxf.spring.context.ApplicationListener;

/**
 * @author xs.wu
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster {

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    @Override
    @SuppressWarnings("unchecked")
    public void multicastEvent(final ApplicationEvent event) {
        for (ApplicationListener applicationListener : getApplicationListeners(event)) {
            applicationListener.onApplicationEvent(event);
        }
    }
}
